import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import ThreadedAdbClient 1.0
import QtCore

Rectangle {
    id: rootItem
    // color: '#26d198'
    ThreadedAdbClient {
        id: adbMowerClient

        onGetInstallVersionFinished: function (ret, version) {
            console.log("Install Version: " + ret + " " + version)
        }
        onGetSerialNumberFinished: function (ret, serialNumber) {
            console.log("Serial Number: " + ret + " " + serialNumber)
        }
        onGetBlePairingCodeFinished: function (ret, code) {
            console.log("Pairing Code: " + ret + " " + code)
        }

        Component.onCompleted: {
            console.log("Component.onCompleted")
            adbMowerClient.connectDev()
        }
    }

    Rectangle {
        anchors.right: parent.right
        width: 12
        height: 12
        color: adbMowerClient.connectedState ? "green" : "red"
    }

    Row{
        Button {
            text: "Install Ver"
            onClicked: adbMowerClient.getInstallVersion()
        }

        Button {
            text: "Read SN"
            onClicked: adbMowerClient.getSerialNumber()
        }

        Button {
            text: "Read Pairing Code"
            onClicked: adbMowerClient.getBlePairingCode()
        }
    }

    Settings {}
}